The invention relates to smart cards in connection with mobile communication devices, more specifically to the communication between apparatuses external to a mobile communication device and a smart card connected to the mobile communication device.
A subscriber identity module, known as a SIM card, is a smart card used in mobile communication devices, like in mobile stations, in the GSM system, comprising e.g. the subscriber's identification information such as the subscriber's phone number. The GSM system directs a user's incoming calls to the mobile station which has the user's SIM card in it. The user can change mobile stations simply by moving the SIM card from an apparatus to another. In addition to said identification information, also short messages in accordance with the SMS service, the user's private phone book and other user-selectable information can be stored on the SIM card. Furthermore, the GSM system may store various control data on the SIM card. The SIM card and the structure of the GSM system are described in more detail e.g. in "The GSM System for Mobile Communications" by Michel Mouly and Marie-Bernadette Pautet. ISBN 2-9507190-0-7, Palaiseau 1992. The SIM card is described in detail in the GSM recommendation ETSI GSM 11.11 and in the ISO/IEC 7816 standard.
Information on the SIM card is organized in files and inside the files typically in records. The SIM card is controlled using low-level commands, or so-called APDU commands, the structure of which is described in detail in paragraph 5.3 of the ISO/IEC 7816-4 standard. For example, when reading information from the SIM card, the first command must tell the card to select a particular file and data record. Then, by means of a second command, the SIM card can be told to return the value of the data record in question.
Thus, storing information on the card and reading it from the card require several commands which have to be given consecutively in a correct order. In the prior art, the correct order of the commands is ensured using a SIM card control element which receives commands from the other blocks of the mobile station, carries out the actions required by the commands and returns possible results to the blocks that issued the commands. Typically, the other blocks of the mobile station give only one high-level command to the SIM card control element to indicate the action they require, and the SIM card control element is responsible for sending the corresponding low-level APDU command sequence to the SIM card.
FIG. 1 shows an example of a system according to the prior art. The system of this example comprises a mobile station 1 which includes a communication part 6, a SIM control element 4, a SIM card interface 16 and an I/O interface 8. The system also includes a SIM card 2 connected to the SIM card interface and an external apparatus 12, such as a portable computer, for example, connected to the mobile station's I/O interface. As a further example, the mobile station and the external apparatus may be functional units of a single device such as a multifunction portable communication device, which comprises a mobile station means and a computer, in which case the I/O interface between the mobile station means and the computer is internal to the multifunction portable communication device. FIG. 2 shows an example of message exchange in the system according to FIG. 1.
FIG. 2 shows an example of the SIM card control messaging according to the prior art. The example describes the operation of the SIM card control element 4 in a situation where the control element 4 receives a new high-level command while executing the SIM card command sequence required by the previous high-level command. To illustrate this, the example of FIG. 2 includes two communication part blocks 6a, 6b which process the information on the SIM card 2 and which both give high-level commands to the SIM card control element. In practice, the blocks 6a, 6b may be e.g. two software processes running in the mobile station's processor, handling different functions.
The SIM card control element 4 receives from the other blocks 6a, 6b of the mobile station manipulation commands for the SIM card 2 and manipulates the SIM card according to the commands. In the example of FIG. 2, a first block 6a of the mobile station sends to the SIM card control element a fetch command for the SIM card's IMSI code. The SIM card control element is responsible for giving the low-level instructions to the SIM card. First, the SIM card control element 4 sends to the SIM card 2 a select IMSI file command and the SIM card responds by returning an acknowledgment. Having received the acknowledgment the SIM card control element 4 sends to the SIM card 2 a read IMSI code command, and the SIM card returns the desired IMSI code to the control element 4. The SIM card control element returns the IMSI code to the first block 6a.
In the example of FIG. 2, a second block 6b of the communication part sends to the SIM card control element a store SMS request at the same time when the control element is exchanging information with the SIM card. The SIM card control element 4 will not start processing the command from the second block 6b immediately, but the command remains waiting until the control element finishes the previous task. Having returned the IMSI code to the first block 6a at the end of the previous task the SIM card control element starts processing the next command. First, the SIM card control element 4 sends a SELECT.sub.-- FILE.sub.-- SMS command to the SIM card, and when the SIM card has returned an acknowledgment the control element issues an UPDATE.sub.-- RECORD.sub.-- SMS command. When the SIM card has stored the SMS message it returns an acknowledgment to the control element which in turn returns an acknowledgment to the original command sent by the second block 6b of the communication part.
However, the prior art arrangement described above causes problems when the mobile station is connected to an external apparatus which directly manipulates the information on the mobile station's SIM card. Problems particularly arise in a situation wherein it is desirable to manipulate the information on the SIM card with complete freedom, bypassing the functions of the mobile station, using e.g. a new method unknown to the mobile station's SIM card control element. Such a property is needed e.g. when creating new GSM services. In such a case, the external apparatus must send to the mobile station low-level SIM commands which the SIM card control element merely passes on to the SIM card. Since the SIM card control element in this case does not know the command sequence needed to execute the required operation, it also does not know whether or not the command sequence initiated by the external apparatus has been completed. Therefore it is possible that the SIM card control element may start carrying out commands issued by other blocks of the mobile station in the middle of a command sequence from an external apparatus and thus cause an error. Futhermore, the arrangement according to the prior art also gives rise to problems in a situation in which multiple SIM cards are connected to a mobile station.
FIG. 3 shows a possible problematic situation according to the prior art. In this example a mobile station is connected to an external apparatus 12 such as a portable personal computer. In this example the mobile station's SIM card 2 is used by the communication part 6 of the mobile station and said external computer 12. First, the computer sends to the mobile station a SELECT.sub.-- FILE.sub.-- ADN command to select the desired file and record. The SIM card control element 4 passes the command on to the SIM card 2 which returns an acknowledgment. At this point, the ADN data record is selected on the SIM card, as required by the external apparatus. Then the communication part 6 of the mobile station sends to the SIM card control element an UPDATE.sub.-- BCCH.sub.-- INFO command, and the SIM card control element sends to the SIM card a selection command for the file and the BCCH data record. When the SIM card acknowledges that the BCCH data record is selected, the SIM card control element 4 issues an UPDATE.sub.-- BINARY.sub.-- BCCH command, and when the record has been updated the SIM card again returns an acknowledgment to the control element. The control element 4 in turn returns an acknowledgment to the communication part 6 of the mobile station indicating that the sequence is completed. The error occurs when the external apparatus 12 issues the next command of its command sequence, UPDATE.sub.-- RECORD.sub.-- ADN, which is then passed on to the SIM card by the SIM card control element. At this stage, the data record that is selected on the SIM card is the BCCH and not the ADN as presumed by the external apparatus and required by the command UPDATE.sub.-- RECORD .sub.-- ADN. Since the ADN and BCCH data records are of different types the SIM card detects the error and returns an error notice UPDATE.sub.-- RECORD.sub.-- ADN.sub.-- FALSE which is then sent back to the external apparatus by the SIM card control element.
A more problematic erroneous situation arises in a case in which the data record selected in the previous command sequence is of the same type as the record required by the command issued by the external apparatus. In such a case the SIM card will not detect the error because the data record type is correct but returns an acknowledgment indicating that the command was carried out successfully. In such a case the external apparatus will not detect the error and the data is stored in the wrong file.
According to the prior art, the problematic situations described above can be avoided in such a way that the external apparatus issues only said high-level commands, e.g. like the first and second blocks 6a, 6b of the communication part, in the manner disclosed in connection with the description of FIG. 2. Then the SIM card control element can place the commands from the external apparatus in queue with the commands from the internal blocks of the mobile station and execute the low-level SIM card commands required by those commands in the correct order. The disadvantage of this arrangement is that the external apparatus can only use a selection of commands known to the SIM card control element.